<template>
  <div class="container view-container">
    <div class="screen">
      <div id="screenId"></div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { onActivated, nextTick } from 'vue';
import { useRoute } from 'vue-router';
import Player from 'xgplayer';

const router = useRoute();

let selectPlayer = new Player({});

onActivated(async () => {
  let params = router.query.params?.toString();
  if (params != null) {
    let videoFileListQuery = JSON.parse(params);
    await nextTick();
    let item = videoFileListQuery[0];
    selectPlayer = new Player({
      id: `screenId`,
      url: `${item.save_path}\\${item.video_name}`,
      height: '100%',
      width: '100%',
      autoplay: true,
    });
  }
});
</script>
<style lang="less" scoped>
.container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  .screen {
    flex: 1;
    width: 100%;
    height: 100%;
    padding: 10px;
    background-color: #020f1b;
    border: solid 1px rgb(255, 189, 91);
  }
}
</style>
